<div class="config-header" id="wrapper" style="width:auto;">
    <div id="container" style="width:auto; position:static;">
        <div id="top" style="height:auto;">
            <h1 id="main-logo" style="width:350px;"><a href="./"><img height="40" src="<?php  echo  image_path("msa/msa_logo.png") ?>"></a>
                <div id="sync-data">
                    <div class="load-cells">
                        <div class="load-cell localCreateClient"></div>
                        <div class="load-cell localSaveEvent"></div>
                        <div class="load-cell localMoveEvent"></div>
                        <div class="load-cell localResizeEvent"></div>
                        <div class="load-cell localDeleteEvent"></div>
                        <div class="load-cell resynchronizeAgendas"></div>
                    </div>
                    <p class="infos"></p>
                    <div class="ajax-config-loader-small">Chargement...</div>
                    <p class="offline">Connexion à internet absente, reconnectez vous avant d'effectuer une sauvegarde.</p>
                    <div style="display:none" id="sync-reload-action" class="pointer">Sauvegarder / Synchroniser les agendas</div>
                </div> 
            </h1>

            <div id="labels">
                <ul>
                    <?php 
                    $login_infos = Erra_Persistance_Session::get('login_infos');
                    $infos = '';
                    if (is_object($login_infos)) {
                        $infos = $login_infos->nom . ' ' . $login_infos->prenom;
                    }
                    $vue_calendrier = ($GET_viewProperty == 'web') ? '' : 'view-type-selected';
                    $vue_web = ($GET_viewProperty == 'web') ? 'view-type-selected' : '';
                    ?>
                    <div style="float:left; margin-right:20px;">
                        <table class="agenda-views">
                            <tr><td>
                                    <div class="calendar-view-type calendar-view-type-standard <?php  echo  $vue_calendrier ?>">
                                        <span class="pointer">Prise de rendez-vous</span> 
                                    </div>
                                </td><td>
                                    <?php  if (Access_ControlObject::get('is_admin') > 0) : ?>
                                        <div class="calendar-view-type calendar-view-type-web <?php  echo  $vue_web ?>">
                                            <span class="pointer">Disponibilités</span>
                                        </div>
                                    <?php  endif; ?>
                                </td></tr>
                        </table>
                    </div>

                    <li><a href="<?php  echo  Erra_System_PageBuilder::makeLink('edit-profile') ?>" class="user"><span class="bar">Bienvenue <?php  echo  $infos ?></span></a></li>
                    <li><a href="<?php  echo  Erra_System_PageBuilder::makeLink('disconnect-user') ?>" class="logout"></a></li>
                </ul>
                <div class="contact-ibc contact-ibc-calendar"><?php  echo  Tools_ContactPopupObject::getObject(uniqid(), 'CREATE')->_editInPlace('AdminAction/sendContactMessage', 'Besoin d\'aide') ?></div>

               
            </div>
            <div id="menu">
                <?php 
                $current_calendar = (Erra_System_PageBuilder::getCurrentPageName() == 'calendar') ? ' class="current" ' : '';
                if (Access_ControlObject::get('is_admin') > 1) {
                    $current_accueil = (Erra_System_PageBuilder::getCurrentPageName() == 'default') ? ' class="current" ' : '';
                    $current_agenda = (Erra_System_PageBuilder::getCurrentPageName() == 'planning') ? ' class="header-agendas" ' : '';
                    $current_location = (Erra_System_PageBuilder::getCurrentPageName() == 'location') ? ' class="header-lieux" ' : '';
                    $current_prestations = (Erra_System_PageBuilder::getCurrentPageName() == 'prestations') ? ' class="header-prestations" ' : '';
                    $current_acces = (Erra_System_PageBuilder::getCurrentPageName() == 'acces') ? ' class="header-acces" ' : '';
                    $current_client = (Erra_System_PageBuilder::getCurrentPageName() == 'clients') ? ' class="header-clients" ' : '';
                    $current_stats = (Erra_System_PageBuilder::getCurrentPageName() == 'stats') ? ' class="header-stats" ' : '';
                }
                if (Access_ControlObject::get('is_admin') == 3) {
                    $current_mailsms = (strstr(Erra_System_PageBuilder::getCurrentPageName(), 'mail-sms')) ? ' class="header-mailsms" ' : '';
                    $current_config = (Erra_System_PageBuilder::getCurrentPageName() == 'configuration') ? ' class="header-configuration" ' : '';
                }
                ?>
                <ul>  
                    <?php  if (Access_ControlObject::get('is_admin') > 1) : ?>
                        <li<?php  echo  $current_accueil ?>><a href="<?php  echo  Erra_System_PageBuilder::makeAjaxLink('default') ?>">Accueil</a></li> 
                    <?php  endif; ?>
                    <li<?php  echo  $current_calendar ?>><a href="<?php  echo  Erra_System_PageBuilder::makeAjaxLink('calendar') ?>">Agendas</a></li>
                    <?php  if (Access_ControlObject::get('is_admin') > 1) : ?>
                        <li<?php  echo  $current_agenda ?>><a href="<?php  echo  Erra_System_PageBuilder::makeAjaxLink('planning') ?>">Gérer agendas</a></li> 
                        <li<?php  echo  $current_location ?>><a href="<?php  echo  Erra_System_PageBuilder::makeAjaxLink('location') ?>">Lieux</a></li> 
                        <li<?php  echo  $current_prestations ?>><a href="<?php  echo  Erra_System_PageBuilder::makeAjaxLink('prestations') ?>">Prestation</a></li>
                        <li<?php  echo  $current_acces ?>><a href="<?php  echo  Erra_System_PageBuilder::makeAjaxLink('acces') ?>">Accès</a></li>
                        <li<?php  echo  $current_client ?>><a href="<?php  echo  Erra_System_PageBuilder::makeAjaxLink('clients') ?>">Clients</a></li>       
                        <li<?php  echo  $current_stats ?>><a href="<?php  echo  Erra_System_PageBuilder::makeAjaxLink('stats') ?>">Stats</a></li>
                    <?php  endif; ?>

                    <?php  if (Access_ControlObject::get('is_admin') == 3) : ?>
                        <li<?php  echo  $current_mailsms ?>><a href="<?php  echo  Erra_System_PageBuilder::makeAjaxLink('mail-sms') ?>">Mails/SMS</a></li>
                        <li style="border-right:none;" <?php  echo  $current_config ?>><a style="border-right:none;" href="<?php  echo  Erra_System_PageBuilder::makeAjaxLink('configuration') ?>">Config</a></li>
                    <?php  endif; ?>
                </ul>
            </div>
        </div>






        <div class="calendar-config-items" data-access="<?php  echo  Access_ControlObject::get_user_id() ?>" data-show-notifications="<?php  echo  Config_GeneralConfigObject::get('show_notifications') ?>">
            <div id="calendar-previous-btn" class="erra-form-field-instance pointer live-click" data-function="ajax_config_element">
                <img src="<?php  echo  config_get('public_images') ?>/icons/go-previous.png" width="32"/>
            </div>
            <center>
                <div id="calendar-fullscreen" class="erra-form-field-instance pointer live-click" data-function="toggleFullScreen">
                    <span id="fullscreen-text">Plein écran</span>
                    <br/>
                    <img src="<?php  echo  config_get('public_images') ?>/icons/button_fullscreen.png" width="25"/>
                </div>
                <div id="calendar-today-btn" class="erra-form-field-instance pointer live-click" data-function="ajax_config_element">
                    Aujourd'hui
                    <br/>
                    <img src="<?php  echo  config_get('public_images') ?>/icons/calendar.png" width="25"/>
                </div>
                <div id="calendar-startdate-btn" class="erra-form-field-instance pointer live-click" data-function="ajax_config_element">
                    <?php  echo  Config_ConfigObject::ajaxConfig('date_de_depart') ?>
                </div>
                <div id="header_options_affichage"  class="erra-form-field-instance erra-popup pointer">
                    Options d'affichage
                    <br/>
                    <img src="<?php  echo  config_get('public_images') ?>/icons/display_properties.png" width="25"/>
                    <div id="header_options_affichage_popup" class="erra-popup-content modal" title="Options d'affichage">
                        <?php  echo  Config_ConfigObject::ajaxConfig('jours_a_afficher') ?>
                        <?php  echo  Config_ConfigObject::ajaxConfig('jour_de_demarrage') ?>
                        <?php  echo  Config_ConfigObject::ajaxConfig('heure_de_debut') ?>
                        <?php  echo  Config_ConfigObject::ajaxConfig('heure_de_fin') ?>
                        <?php  echo  Config_ConfigObject::ajaxConfig('nb_intervalles_par_heure') ?>
                    </div>
                </div>
                <div id="header_afficher_agendas" class="erra-form-field-instance erra-popup pointer">
                    Afficher agendas
                    <br/>
                    <img src="<?php  echo  config_get('public_images') ?>/icons/display_agendas.png" width="24"/>
                    <div  id="header_afficher_agendas_popup"  class="erra-popup-content" title="Afficher agendas"  data-width="350">
                        <?php  echo  Config_ConfigObject::ajaxConfig('afficher_agendas') ?>
                        <input type="button" value="Enregistrer" id="save_agendas" class="live-click pointer" data-function="ajax_save_agendas"> 
                    </div>
                </div>
                <div id="header_afficher_corbeille" class="erra-form-field-instance pointer">
                    <?php  $trashHtml = 'Corbeille<br/><img src="' . config_get('public_images') . '/icons/trash_mail.png" width="24"/>'; ?>
                    <?php  echo  Msa_SlotObjectTrash::getList('ORDER BY slot_day DESC')->_editInPlace('saveAction', $trashHtml) ?>

                </div>
                <div id="header_afficher_sync" class="erra-form-field-instance erra-popup pointer">
                    Synchronisation
                    <br/>
                    <img src="<?php  echo  config_get('public_images') ?>/icons/google_calendar.png" width="24"/>
                    <div  id="header_afficher_sync_popup"  class="erra-popup-content modal" title="Synchronisation Google Calendar">
                        <?php  echo  Config_ConfigObject::ajaxConfig('agenda_google') ?><br/>
                        <?php  echo  Config_ConfigObject::ajaxConfig('google_agenda_id') ?>
                        <?php  echo  Config_ConfigObject::ajaxConfig('login_google') ?>
                        <?php  echo  Config_ConfigObject::ajaxConfig('pwd_google') ?>
                        <input type="button" value="Synchroniser" id="save_google" class="live-click pointer" data-function="ajax_save_google"> 
                    </div>
                </div>
                <div class="erra-form-field-instance erra-popup pointer">
                    <?php 
                    echo Erra_Fields_Autocomplete::create('calendar_edit_client')
                            ->setDataSource("getdata/client_list_uniqid")
                            ->addAttribute('class', 'calendar-edit-client lazy')
                            ->setDatabaseType('NONE')
                            ->setDescription('Client')
                            ->edit();

                    echo Erra_Fields_Hidden::create('calendar_edit_client_id')
                            ->addAttribute('class', 'calendar-hidden-client-id')
                            ->edit();
                    ?>
                    <div style="display:none;">
                        <?php  echo 
                                Msa_ClientObject::getObject(uniqid(), 'CREATE', null, 'calendar_client')
                                ->addAttribute('class', 'manual_editable_in_place client-edit')
                                ->_editInPlace('SaveAction/saveClient', 'HIDDEN_CLIENT_OBJECT')
                        ?>
                    </div>
                </div>
                <div id="calendar-next-btn" class="erra-form-field-instance pointer live-click" data-function="ajax_config_element">
                    <img src="<?php  echo  config_get('public_images') ?>/icons/go-next.png" width="32"/>
                </div>
            </center>
        </div>



    </div>
</div>